package killer.board.notice.service;

import java.util.List;

import killer.board.common.BoardVO;
import killer.board.notice.model.NoticeBoardDao;
import killer.board.notice.model.NoticeBoardVO;
import killer.paging.ListVO;
import killer.paging.PagingBean;

public class NoticeBoardServiceImpl extends NoticeBoardService {
	
	private NoticeBoardDao noticeBoardDao;
	
	public NoticeBoardServiceImpl(NoticeBoardDao noticeBoardDao) {
		this.noticeBoardDao=noticeBoardDao;
	}
	
	/**
	 * 공지사항 게시판 게시물을 등록하는 메서드
	 */
	/*@Override*/
	public BoardVO registerBoardWriting(BoardVO bvo) throws Exception {
		noticeBoardDao.registerNotice((NoticeBoardVO) bvo);
		return bvo;
	}
	
	/**
	 * 공지사항 게시판 한 페이지 게시글을 보여주는 메서드
	 */
	/*@Override*/
	public ListVO getBoardWritingList(int nowPage)throws Exception {
		int pageNo=1;
		if(nowPage!=1){
			pageNo=nowPage;
		}
		int totalPage=noticeBoardDao.selectTotalContents();
		List list=noticeBoardDao.selectNoticeList(pageNo);
		PagingBean pb=new PagingBean(totalPage,pageNo);
		ListVO lvo=new ListVO(list,pb);
		return lvo;
	}

	/**
	 * 선택한 게시물 상세정보를 보여주는 메서드
	 */
	/*@Override*/
	public BoardVO getBoardWritingByNo(int boardNo)throws Exception {
		NoticeBoardVO Nbvo=noticeBoardDao.selectNoticeByNo(boardNo);
		return Nbvo;
	}


	
}
